#pragma once
#include "../bondlib.h"
#include "../BondInfo.h"
#include <map>
#include <list>
#include <string>
#include <qbprotocol/include/SSFilters.h>

class IBrokerKeyDest;
class CBondBankRep;
class CBondCompanyRep;
class CCFETSQuoteRep;
class S_BONDLIB_EXPORT CBondFilter{
	typedef std::map<int, CBondInfo> CBondInfoMap;
	BLHCONDITION*			m_condition;
	BLHCONDITION			m_condition_temp;
	bool					bAll;
	bool					m_use_condition;
	std::list<std::string>	m_brokls;
	bool					m_checkbonds;
	CBondInfoMap			m_listedbonds;
public:

	static CBondBankRep* GetBankRep(int nIndex);
	static CBondBankRep* GetClntRep(int nIndex);
	static CBondCompanyRep* GetCompanyRep(int nIndex);
	static CCFETSQuoteRep* GetCFETSRep(int nIndex);
	static int GetAllBondsSize();

	CBondFilter();
	void SetCondition(BLHCONDITION* blh, bool bAll);
	void SetBrokers(const std::list<std::string>& brokers);
	bool ProcessBond(int nTmpKey, IBrokerKeyDest* dest, void* context);
	bool ProcessBondCFETS(int nType, int nTmpKey, IBrokerKeyDest* dest, void* context);
	bool ProcessBondCFETSDeal(int nTmpKey, IBrokerKeyDest* dest, void* context);
	bool ProcessBondSSEFI(int nTmpKey, IBrokerKeyDest* dest, void* context);
	void BeforeReloads();
	void AfterReloads();
	void CheckBonds(int bid);

	BLHCONDITION* GetCondition();
};
